<?php


namespace App\Service\Cache;


use App\Dao\RegionDao;
use Hyperf\Cache\Annotation\Cacheable;
use Hyperf\Di\Annotation\Inject;

class RegionCache
{

    /**
     * @Inject()
     * @var RegionDao
     */
    protected $regionDao;

    /**
     * @Cacheable(prefix="\App\Constants\Redis\Region::LIST",ttl=28800)
     */
    public function get($id)
    {
        $region = $this->regionDao->first(['id' => $id]);

        if ($region) {
            return $region->toArray();
        }

        return null;
    }
}